﻿using System;
using System.Collections.Generic;
using Gp.Scripts.Core;
using Sirenix.OdinInspector;
using UnityEngine;
using UnityEngine.Serialization;
// ReSharper disable InconsistentNaming

namespace Gp.Scripts.Data.Skills {
    [Serializable]
    public struct CostInfo {
        public static CostInfo ActionOnly => new() {action = true, reaction = false, amount = 1};
        public static CostInfo ReactionOnly => new() {action = false, reaction = true, amount = 1};


        public static CostInfo All => new() {action = true, reaction = true, amount = 1};
        
        
        public static CostInfo ActionOnly_Double => new() {action = true, reaction = false, amount = 2};
        public static CostInfo ReactionOnly_Double => new() {action = false, reaction = true, amount = 2};
        
        public static CostInfo All_Double => new() {action = true, reaction = true, amount = 2};


        [LabelText("进攻点消耗")]
        public bool action;
        [LabelText("防御点消耗")]
        public bool reaction;
        
        [LabelText("消耗数量")]
        public int amount;

        public CostInfo(bool action, bool reaction, int amount) {
            this.action = action;
            this.reaction = reaction;
            this.amount = amount;
        }


        public IEnumerable<ResourceCost> ToCosts() {
            if (action) yield return new ResourceCost(CostField.ActionTime, amount);
            if (reaction) yield return new ResourceCost(CostField.Reaction, amount);
        }
    }
    
    
    
    
    
    
    // [Serializable]
    // public class ResourceCostInfo {
    //     [HideLabel]
    //     public CostInfo costInfo = CostInfo.ActionOnly;
    //
    //     public IEnumerable<ResourceCost> Costs() {
    //         return costInfo.ToCosts();
    //     }
    // }
    public abstract class AbilitySkillEntityConfig : SkillEntityConfig {
        [VerticalGroup("数据/status")] 
        [LabelText("行动消耗")]
        public CostInfo costInfo = CostInfo.ActionOnly;
        
        [LabelText("技能特效")]
        public SkillFx skillFx;
    }
}